package com.dep.dto.req;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import java.io.Serializable;

@Data
public class DepartmentInsertReq implements Serializable {

    @ApiModelProperty(value = "部门编号",required = true)
    @NotBlank(message = "部门编号不能为空")
    @Pattern(regexp = "^[\\u4e00-\\u9fa5a-zA-Z0-9]{0,}$",message = "部门编号不支持特殊字符")
    @Length(max = 20,message = "部门编号长度过长,不能超过20个字符")
    private String depNo;

    @ApiModelProperty(value = "部门名称",required = true)
    @NotBlank(message = "部门名称不能为空")
    @Pattern(regexp = "^[\\u4e00-\\u9fa5a-zA-Z0-9]{0,}$",message = "部门名称不支持特殊字符")
    @Length(max = 20,message = "部门名称长度过长,不能超过20个字符")
    private String depName;

    @ApiModelProperty(value = "上一级部门id, 0为最上级部门",required = true)
    @NotNull(message = "部门id不能为空")
    private Long parentId;

    @ApiModelProperty(value = "成立时间 yyyy-MM-dd HH:mm:ss",required = true)
    @Pattern(regexp = "^$|^(19|20)\\d{2}\\-[01]\\d\\-[0123]\\d\\s\\d{2}\\:\\d{2}\\:\\d{2}$", message = "日期格式不正确，如yyyy-MM-dd HH:mm:ss")
    @NotBlank(message = "入职时间不能为空")
    private String establishAtStr;
}
